package lily.phs.vaccination;
import lily.phs.object.HereTipa;
import lily.phs.object.VaccinationCard;
import lily.phs.object.VaccinationRecord;
import lily.phs.urh.R;
import lily.phs.vaccination.VaccinationCardView.MyView;
import lily.ui.control.MyPopupWindow;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.text.InputType;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

public class VaccinationRecordView2 extends RelativeLayout implements OnClickListener,OnFocusChangeListener{
	private EditText vare_AMenV1_date,vare_AMenV1_position,vare_AMenV1_batch_num,vare_AMenV1_doctor,vare_AMenV1_remark,
					vare_AMenV2_date,vare_AMenV2_position,vare_AMenV2_batch_num,vare_AMenV2_doctor,vare_AMenV2_remark,
					vare_A_CMenV1_date,vare_A_CMenV1_position,vare_A_CMenV1_batch_num,vare_A_CMenV1_doctor,vare_A_CMenV1_remark,
					vare_A_CMenV2_date,vare_A_CMenV2_position,vare_A_CMenV2_batch_num,vare_A_CMenV2_doctor,vare_A_CMenV2_remark,
					vare_yinao_live_vaccine1_date,vare_yinao_live_vaccine1_position,vare_yinao_live_vaccine1_batch_num,
					vare_yinao_live_vaccine1_doctor,vare_yinao_live_vaccine1_remark,
					vare_yinao_live_vaccine2_date,vare_yinao_live_vaccine2_position,vare_yinao_live_vaccine2_batch_num,
					vare_yinao_live_vaccine2_doctor,vare_yinao_live_vaccine2_remark,
					vare_yinao_inactivated_vaccine1_date,vare_yinao_inactivated_vaccine1_position,vare_yinao_inactivated_vaccine1_batch_num,
					vare_yinao_inactivated_vaccine1_doctor,vare_yinao_inactivated_vaccine1_remark,
					vare_yinao_inactivated_vaccine2_date,vare_yinao_inactivated_vaccine2_position,vare_yinao_inactivated_vaccine2_batch_num,
					vare_yinao_inactivated_vaccine2_doctor,vare_yinao_inactivated_vaccine2_remark,
					vare_yinao_inactivated_vaccine3_date,vare_yinao_inactivated_vaccine3_position,vare_yinao_inactivated_vaccine3_batch_num,
					vare_yinao_inactivated_vaccine3_doctor,vare_yinao_inactivated_vaccine3_remark,
					vare_yinao_inactivated_vaccine4_date,vare_yinao_inactivated_vaccine4_position,vare_yinao_inactivated_vaccine4_batch_num,
					vare_yinao_inactivated_vaccine4_doctor,vare_yinao_inactivated_vaccine4_remark,
					vare_Armour_liver_vaccine_decrease_toxicity_date,vare_Armour_liver_vaccine_decrease_toxicity_position,vare_Armour_liver_vaccine_decrease_toxicity_batch_num,
					vare_Armour_liver_vaccine_decrease_toxicity_doctor,vare_Armour_liver_vaccine_decrease_toxicity_remark,
					vare_vaqta1_date,vare_vaqta1_position,vare_vaqta1_batch_num,vare_vaqta1_doctor,vare_vaqta1_remark,
					vare_vaqta2_date,vare_vaqta2_position,vare_vaqta2_batch_num,vare_vaqta2_doctor,vare_vaqta2_remark,
					vare_other_vaccine1_date,vare_other_vaccine1_position,vare_other_vaccine1_batch_num,vare_other_vaccine1_doctor,vare_other_vaccine1_remark,
					vare_other_vaccine2_date,vare_other_vaccine2_position,vare_other_vaccine2_batch_num,vare_other_vaccine2_doctor,vare_other_vaccine2_remark,
					vare_other_vaccine3_date,vare_other_vaccine3_position,vare_other_vaccine3_batch_num,vare_other_vaccine3_doctor,vare_other_vaccine3_remark,
					vare_other_vaccine4_date,vare_other_vaccine4_position,vare_other_vaccine4_batch_num,vare_other_vaccine4_doctor,vare_other_vaccine4_remark,
					vare_other_vaccine5_date,vare_other_vaccine5_position,vare_other_vaccine5_batch_num,vare_other_vaccine5_doctor,vare_other_vaccine5_remark,
					vare_other_vaccine6_date,vare_other_vaccine6_position,vare_other_vaccine6_batch_num,vare_other_vaccine6_doctor,vare_other_vaccine6_remark;
	
	
	VaccinationRecord vr2;
//	VaccinationCard vc;
	HereTipa ht;
	View v;
	MyPopupWindow mPopupWindow;
	Paint paint;
	private LinearLayout ll;
	Context myContext;
	int ProfileId=0;
	public VaccinationRecordView2(Context context,int pro) {
		super(context);
		this.myContext=context;
		ProfileId=pro;
		// TODO Auto-generated constructor stub
		paint=new Paint();
		paint.setStyle(Paint.Style.FILL_AND_STROKE);
		paint.setTypeface(Typeface.DEFAULT_BOLD);
		paint.setColor(Color.BLACK);
		
		
	}
	public void addToView(){
		LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(v,lp);
		MyView mv=new MyView(myContext);
		this.addView(mv,lp);
	}
	class MyView extends View{
		 View v;
		 Paint paint;
		 public MyView(Context context){
			 super(context);
			 paint=new Paint();
			 paint.setStyle(Paint.Style.FILL_AND_STROKE);
			 paint.setTypeface(Typeface.DEFAULT_BOLD);
			 paint.setColor(Color.BLACK);
			
		 }
		 public void onDraw(Canvas c){
			 int top=ll.getTop()+50;
			 int left=ll.getLeft()+30;
			 int right=ll.getRight()+30;
			 int y=0;
			 top=top-y;
			 c.drawLine(left, top, right, top, paint);
			 c.drawLine(left, top+50, right, top+50, paint);
			 c.drawLine(left+120, top+100, right, top+100, paint);
			 c.drawLine(left, top+150, right, top+150, paint);
			 c.drawLine(left+120, top+200, right, top+200, paint);
			 c.drawLine(left, top+250, right, top+250, paint);
			 c.drawLine(left+120, top+300, right, top+300, paint);
			 c.drawLine(left, top+350, right, top+350, paint);
			 c.drawLine(left+120, top+400, right, top+400, paint);
			 c.drawLine(left+120, top+450, right, top+450, paint);
			 c.drawLine(left+120, top+500, right, top+500, paint);
			 c.drawLine(left, top+550, right, top+550, paint);
			 c.drawLine(left, top+600, right, top+600, paint);
			 c.drawLine(left+120, top+650, right, top+650, paint);
			 c.drawLine(left, top+700, right, top+700, paint);
		//	 c.drawLine(left, top+700, right, top+700, paint);
			 c.drawLine(left, top+750, right, top+750, paint);
			 c.drawLine(left, top+800, right, top+800, paint);
			 c.drawLine(left, top+850, right, top+850, paint);
			 c.drawLine(left, top+900, right, top+900, paint);
			 c.drawLine(left, top+950, right, top+950, paint);
			 c.drawLine(left, top+1000, right, top+1000, paint);
 
			 c.drawLine(left, top, left, top+1000, paint);
			 c.drawLine(right, top, right, top+1000, paint);
			 c.drawLine(left+180, top, left+180, top+1000, paint);
			 c.drawLine(left+300, top, left+300, top+1000, paint);
			 c.drawLine(left+400, top, left+400, top+1000, paint);
			 c.drawLine(left+500, top, left+500, top+1000, paint);
			 c.drawLine(left+600, top, left+600, top+1000, paint);
		//	 c.drawLine(left+120, top+50, left+120, top+200, paint);
			 c.drawLine(left+120, top+50, left+120, top+550, paint);
			 c.drawLine(left+120, top+600, left+120, top+700, paint);
		//	 c.drawLine(left+120, top+900, left+120, top+1000, paint);
			 
		 }
	}
	public void findWidget(){
		LayoutInflater factory=LayoutInflater.from(myContext);
		v=factory.inflate(R.layout.vaccination_record2, null);
		ll=(LinearLayout)v.findViewById(R.id.fam_eco_hushuxing);
		vare_AMenV1_date=(EditText) v.findViewById(R.id.vare_AMenV1_date);
		vare_AMenV1_date.setInputType(InputType.TYPE_NULL);
		vare_AMenV1_date.setOnClickListener(this);
		vare_AMenV1_date.setOnFocusChangeListener(this);
		vare_AMenV1_position=(EditText) v.findViewById(R.id.vare_AMenV1_position);
		vare_AMenV1_batch_num=(EditText) v.findViewById(R.id.vare_AMenV1_batch_num);
		vare_AMenV1_doctor=(EditText) v.findViewById(R.id.vare_AMenV1_doctor);
		vare_AMenV1_remark=(EditText) v.findViewById(R.id.vare_AMenV1_remark);
		vare_AMenV2_date=(EditText) v.findViewById(R.id.vare_AMenV2_date);
		vare_AMenV2_date.setInputType(InputType.TYPE_NULL);
		vare_AMenV2_date.setOnClickListener(this);
		vare_AMenV2_date.setOnFocusChangeListener(this);
		vare_AMenV2_position=(EditText) v.findViewById(R.id.vare_AMenV2_position);
		vare_AMenV2_batch_num=(EditText) v.findViewById(R.id.vare_AMenV2_batch_num);
		vare_AMenV2_doctor=(EditText) v.findViewById(R.id.vare_AMenV2_doctor);
		vare_AMenV2_remark=(EditText) v.findViewById(R.id.vare_AMenV2_remark);
		vare_A_CMenV1_date=(EditText) v.findViewById(R.id.vare_A_CMenV1_date);
		vare_A_CMenV1_date.setInputType(InputType.TYPE_NULL);
		vare_A_CMenV1_date.setOnClickListener(this);
		vare_A_CMenV1_date.setOnFocusChangeListener(this);
		vare_A_CMenV1_position=(EditText) v.findViewById(R.id.vare_A_CMenV1_position);
		vare_A_CMenV1_batch_num=(EditText) v.findViewById(R.id.vare_A_CMenV1_batch_num);
		vare_A_CMenV1_doctor=(EditText) v.findViewById(R.id.vare_A_CMenV1_doctor);
		vare_A_CMenV1_remark=(EditText) v.findViewById(R.id.vare_A_CMenV1_remark);
		vare_A_CMenV2_date=(EditText) v.findViewById(R.id.vare_A_CMenV2_date);
		vare_A_CMenV2_date.setInputType(InputType.TYPE_NULL);
		vare_A_CMenV2_date.setOnClickListener(this);
		vare_A_CMenV2_date.setOnFocusChangeListener(this);
		vare_A_CMenV2_position=(EditText) v.findViewById(R.id.vare_A_CMenV2_position);
		vare_A_CMenV2_batch_num=(EditText) v.findViewById(R.id.vare_A_CMenV2_batch_num);
		vare_A_CMenV2_doctor=(EditText) v.findViewById(R.id.vare_A_CMenV2_doctor);
		vare_A_CMenV2_remark=(EditText) v.findViewById(R.id.vare_A_CMenV2_remark);
		vare_yinao_live_vaccine1_date=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine1_date);
		vare_yinao_live_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_live_vaccine1_date.setOnClickListener(this);
		vare_yinao_live_vaccine1_date.setOnFocusChangeListener(this);
		vare_yinao_live_vaccine1_position=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine1_position);
		vare_yinao_live_vaccine1_batch_num=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine1_batch_num);
		vare_yinao_live_vaccine1_doctor=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine1_doctor);
		vare_yinao_live_vaccine1_remark=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine1_remark);
		vare_yinao_live_vaccine2_date=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine2_date);
		vare_yinao_live_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_live_vaccine2_date.setOnClickListener(this);
		vare_yinao_live_vaccine2_date.setOnFocusChangeListener(this);
		vare_yinao_live_vaccine2_position=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine2_position);
		vare_yinao_live_vaccine2_batch_num=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine2_batch_num);
		vare_yinao_live_vaccine2_doctor=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine2_doctor);
		vare_yinao_live_vaccine2_remark=(EditText) v.findViewById(R.id.vare_yinao_live_vaccine2_remark);
		vare_yinao_inactivated_vaccine1_date=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine1_date);
		vare_yinao_inactivated_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_inactivated_vaccine1_date.setOnClickListener(this);
		vare_yinao_inactivated_vaccine1_date.setOnFocusChangeListener(this);
		vare_yinao_inactivated_vaccine1_position=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine1_position);
		vare_yinao_inactivated_vaccine1_batch_num=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine1_batch_num);
		vare_yinao_inactivated_vaccine1_doctor=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine1_doctor);
		vare_yinao_inactivated_vaccine1_remark=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine1_remark);
		vare_yinao_inactivated_vaccine2_date=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine2_date);
		vare_yinao_inactivated_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_inactivated_vaccine2_date.setOnClickListener(this);
		vare_yinao_inactivated_vaccine2_date.setOnFocusChangeListener(this);
		vare_yinao_inactivated_vaccine2_position=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine2_position);
		vare_yinao_inactivated_vaccine2_batch_num=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine2_batch_num);
		vare_yinao_inactivated_vaccine2_doctor=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine2_doctor);
		vare_yinao_inactivated_vaccine2_remark=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine2_remark);
		vare_yinao_inactivated_vaccine3_date=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine3_date);
		vare_yinao_inactivated_vaccine3_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_inactivated_vaccine3_date.setOnClickListener(this);
		vare_yinao_inactivated_vaccine3_date.setOnFocusChangeListener(this);
		vare_yinao_inactivated_vaccine3_position=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine3_position);
		vare_yinao_inactivated_vaccine3_batch_num=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine3_batch_num);
		vare_yinao_inactivated_vaccine3_doctor=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine3_doctor);
		vare_yinao_inactivated_vaccine3_remark=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine3_remark);
		vare_yinao_inactivated_vaccine4_date=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine4_date);
		vare_yinao_inactivated_vaccine4_date.setInputType(InputType.TYPE_NULL);
		vare_yinao_inactivated_vaccine4_date.setOnClickListener(this);
		vare_yinao_inactivated_vaccine4_date.setOnFocusChangeListener(this);
		vare_yinao_inactivated_vaccine4_position=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine4_position);
		vare_yinao_inactivated_vaccine4_batch_num=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine4_batch_num);
		vare_yinao_inactivated_vaccine4_doctor=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine4_doctor);
		vare_yinao_inactivated_vaccine4_remark=(EditText) v.findViewById(R.id.vare_yinao_inactivated_vaccine4_remark);
		vare_Armour_liver_vaccine_decrease_toxicity_date=(EditText) v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_date);
		vare_Armour_liver_vaccine_decrease_toxicity_date.setInputType(InputType.TYPE_NULL);
		vare_Armour_liver_vaccine_decrease_toxicity_date.setOnClickListener(this);
		vare_Armour_liver_vaccine_decrease_toxicity_date.setOnFocusChangeListener(this);
		vare_Armour_liver_vaccine_decrease_toxicity_position=(EditText) v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_position);
		vare_Armour_liver_vaccine_decrease_toxicity_batch_num=(EditText) v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_batch_num);
		vare_Armour_liver_vaccine_decrease_toxicity_doctor=(EditText) v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_doctor);
		vare_Armour_liver_vaccine_decrease_toxicity_remark=(EditText) v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_remark);
		vare_vaqta1_date=(EditText) v.findViewById(R.id.vare_vaqta1_date);
		vare_vaqta1_date.setInputType(InputType.TYPE_NULL);
		vare_vaqta1_date.setOnClickListener(this);
		vare_vaqta1_date.setOnFocusChangeListener(this);
		vare_vaqta1_position=(EditText) v.findViewById(R.id.vare_vaqta1_position);
		vare_vaqta1_batch_num=(EditText) v.findViewById(R.id.vare_vaqta1_batch_num);
		vare_vaqta1_doctor=(EditText) v.findViewById(R.id.vare_vaqta1_doctor);
		vare_vaqta1_remark=(EditText) v.findViewById(R.id.vare_vaqta1_remark);
		vare_vaqta2_date=(EditText) v.findViewById(R.id.vare_vaqta2_date);
		vare_vaqta2_date.setInputType(InputType.TYPE_NULL);
		vare_vaqta2_date.setOnClickListener(this);
		vare_vaqta2_date.setOnFocusChangeListener(this);
		vare_vaqta2_position=(EditText) v.findViewById(R.id.vare_vaqta2_position);
		vare_vaqta2_batch_num=(EditText) v.findViewById(R.id.vare_vaqta2_batch_num);
		vare_vaqta2_doctor=(EditText) v.findViewById(R.id.vare_vaqta2_doctor);
		vare_vaqta2_remark=(EditText) v.findViewById(R.id.vare_vaqta2_remark);
		vare_other_vaccine1_date=(EditText) v.findViewById(R.id.vare_other_vaccine1_date);
		vare_other_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine1_date.setOnClickListener(this);
		vare_other_vaccine1_date.setOnFocusChangeListener(this);
		vare_other_vaccine1_position=(EditText) v.findViewById(R.id.vare_other_vaccine1_position);
		vare_other_vaccine1_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine1_batch_num);
		vare_other_vaccine1_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine1_doctor);
		vare_other_vaccine1_remark=(EditText) v.findViewById(R.id.vare_other_vaccine1_remark);
		vare_other_vaccine2_date=(EditText) v.findViewById(R.id.vare_other_vaccine2_date);
		vare_other_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine2_date.setOnClickListener(this);
		vare_other_vaccine2_date.setOnFocusChangeListener(this);
		vare_other_vaccine2_position=(EditText) v.findViewById(R.id.vare_other_vaccine2_position);
		vare_other_vaccine2_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine2_batch_num);
		vare_other_vaccine2_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine2_doctor);
		vare_other_vaccine2_remark=(EditText) v.findViewById(R.id.vare_other_vaccine2_remark);
		vare_other_vaccine3_date=(EditText) v.findViewById(R.id.vare_other_vaccine3_date);
		vare_other_vaccine3_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine3_date.setOnClickListener(this);
		vare_other_vaccine3_date.setOnFocusChangeListener(this);
		vare_other_vaccine3_position=(EditText) v.findViewById(R.id.vare_other_vaccine3_position);
		vare_other_vaccine3_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine3_batch_num);
		vare_other_vaccine3_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine3_doctor);
		vare_other_vaccine3_remark=(EditText) v.findViewById(R.id.vare_other_vaccine3_remark);
		vare_other_vaccine4_date=(EditText) v.findViewById(R.id.vare_other_vaccine4_date);
		vare_other_vaccine4_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine4_date.setOnClickListener(this);
		vare_other_vaccine4_date.setOnFocusChangeListener(this);
		vare_other_vaccine4_position=(EditText) v.findViewById(R.id.vare_other_vaccine4_position);
		vare_other_vaccine4_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine4_batch_num);
		vare_other_vaccine4_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine4_doctor);
		vare_other_vaccine4_remark=(EditText) v.findViewById(R.id.vare_other_vaccine4_remark);
		vare_other_vaccine5_date=(EditText) v.findViewById(R.id.vare_other_vaccine5_date);
		vare_other_vaccine5_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine5_date.setOnClickListener(this);
		vare_other_vaccine5_date.setOnFocusChangeListener(this);
		vare_other_vaccine5_position=(EditText) v.findViewById(R.id.vare_other_vaccine5_position);
		vare_other_vaccine5_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine5_batch_num);
		vare_other_vaccine5_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine5_doctor);
		vare_other_vaccine5_remark=(EditText) v.findViewById(R.id.vare_other_vaccine5_remark);
		vare_other_vaccine6_date=(EditText) v.findViewById(R.id.vare_other_vaccine6_date);
		vare_other_vaccine6_date.setInputType(InputType.TYPE_NULL);
		vare_other_vaccine6_date.setOnClickListener(this);
		vare_other_vaccine6_date.setOnFocusChangeListener(this);
		vare_other_vaccine6_position=(EditText) v.findViewById(R.id.vare_other_vaccine6_position);
		vare_other_vaccine6_batch_num=(EditText) v.findViewById(R.id.vare_other_vaccine6_batch_num);
		vare_other_vaccine6_doctor=(EditText) v.findViewById(R.id.vare_other_vaccine6_doctor);
		vare_other_vaccine6_remark=(EditText) v.findViewById(R.id.vare_other_vaccine6_remark);
	//	vc=new VaccinationCard(myContext);
	//	vc.selectCode(ProfileId);
	//	vc.selectVaccinationCard(ProfileId);
		ht=new HereTipa(myContext);
		ht.selectNameAndCode(ProfileId);
		vr2=new VaccinationRecord(myContext);
		vr2.selectVaccinationRecord(ProfileId);
	}
	public void selectData(){
	//	vc=new VaccinationCard(myContext);
		//vc.selectCode(ProfileId);
		ht.selectNameAndCode(ProfileId);
	//	vr2=new VaccinationRecord(myContext);
		vr2.selectVaccinationRecord(ProfileId);
	}
	public void initVaccinationRecordView2(){
		
		if(vr2.getVare_AMenV1()!=null&&vr2.getVare_AMenV1().length()>0){
			String []arrAMenV1=vr2.getVare_AMenV1().split(",");
			if(arrAMenV1.length>0){
				for(int i=0;i<arrAMenV1.length;i++){
					if(i==0)vare_AMenV1_date.setText(arrAMenV1[i]);
					if(i==1)vare_AMenV1_position.setText(arrAMenV1[i]);
					if(i==2)vare_AMenV1_batch_num.setText(arrAMenV1[i]);
					if(i==3)vare_AMenV1_doctor.setText(arrAMenV1[i]);
					if(i==4)vare_AMenV1_remark.setText(arrAMenV1[i]);
				}
			}
		}
		if(vr2.getVare_AMenV2()!=null&&vr2.getVare_AMenV2().length()>0){
			String []arrAMenV2=vr2.getVare_AMenV2().split(",");
			if(arrAMenV2.length>0){
				for(int i=0;i<arrAMenV2.length;i++){
					if(i==0)vare_AMenV2_date.setText(arrAMenV2[i]);
					if(i==1)vare_AMenV2_position.setText(arrAMenV2[i]);
					if(i==2)vare_AMenV2_batch_num.setText(arrAMenV2[i]);
					if(i==3)vare_AMenV2_doctor.setText(arrAMenV2[i]);
					if(i==4)vare_AMenV2_remark.setText(arrAMenV2[i]);
				}
			}
		}
		if(vr2.getVare_A_CMenV1()!=null&&vr2.getVare_A_CMenV1().length()>0){
			String []arrA_CMenV1=vr2.getVare_A_CMenV1().split(",");
			if(arrA_CMenV1.length>0){
				for(int i=0;i<arrA_CMenV1.length;i++){
					if(i==0)vare_A_CMenV1_date.setText(arrA_CMenV1[i]);
					if(i==1)vare_A_CMenV1_position.setText(arrA_CMenV1[i]);
					if(i==2)vare_A_CMenV1_batch_num.setText(arrA_CMenV1[i]);
					if(i==3)vare_A_CMenV1_doctor.setText(arrA_CMenV1[i]);
					if(i==4)vare_A_CMenV1_remark.setText(arrA_CMenV1[i]);
				}
			}
		}
		if(vr2.getVare_A_CMenV2()!=null&&vr2.getVare_A_CMenV2().length()>0){
			String []arrA_CMenV2=vr2.getVare_A_CMenV2().split(",");
			if(arrA_CMenV2.length>0){
				for(int i=0;i<arrA_CMenV2.length;i++){
					if(i==0)vare_A_CMenV2_date.setText(arrA_CMenV2[i]);
					if(i==1)vare_A_CMenV2_position.setText(arrA_CMenV2[i]);
					if(i==2)vare_A_CMenV2_batch_num.setText(arrA_CMenV2[i]);
					if(i==3)vare_A_CMenV2_doctor.setText(arrA_CMenV2[i]);
					if(i==4)vare_A_CMenV2_remark.setText(arrA_CMenV2[i]);
				}
			}
		}
		if(vr2.getVare_yinao_inactivated_vaccine1()!=null&&vr2.getVare_yinao_inactivated_vaccine1().length()>0){
			String []arryinao_inactivated_vaccine1=vr2.getVare_yinao_inactivated_vaccine1().split(",");
			if(arryinao_inactivated_vaccine1.length>0){
				for(int i=0;i<arryinao_inactivated_vaccine1.length;i++){
					if(i==0)vare_yinao_inactivated_vaccine1_date.setText(arryinao_inactivated_vaccine1[i]);
					if(i==1)vare_yinao_inactivated_vaccine1_position.setText(arryinao_inactivated_vaccine1[i]);
					if(i==2)vare_yinao_inactivated_vaccine1_batch_num.setText(arryinao_inactivated_vaccine1[i]);
					if(i==3)vare_yinao_inactivated_vaccine1_doctor.setText(arryinao_inactivated_vaccine1[i]);
					if(i==4)vare_yinao_inactivated_vaccine1_remark.setText(arryinao_inactivated_vaccine1[i]);
				}
			}
		}
		if(vr2.getVare_yinao_inactivated_vaccine2()!=null&&vr2.getVare_yinao_inactivated_vaccine2().length()>0){
			String []arryinao_inactivated_vaccine2=vr2.getVare_yinao_inactivated_vaccine2().split(",");
			if(arryinao_inactivated_vaccine2.length>0){
				for(int i=0;i<arryinao_inactivated_vaccine2.length;i++){
					if(i==0)vare_yinao_inactivated_vaccine2_date.setText(arryinao_inactivated_vaccine2[i]);
					if(i==1)vare_yinao_inactivated_vaccine2_position.setText(arryinao_inactivated_vaccine2[i]);
					if(i==2)vare_yinao_inactivated_vaccine2_batch_num.setText(arryinao_inactivated_vaccine2[i]);
					if(i==3)vare_yinao_inactivated_vaccine2_doctor.setText(arryinao_inactivated_vaccine2[i]);
					if(i==4)vare_yinao_inactivated_vaccine2_remark.setText(arryinao_inactivated_vaccine2[i]);
				}
			}
		}
		if(vr2.getVare_yinao_inactivated_vaccine3()!=null&&vr2.getVare_yinao_inactivated_vaccine3().length()>0){
			String []arryinao_inactivated_vaccine3=vr2.getVare_yinao_inactivated_vaccine3().split(",");
			if(arryinao_inactivated_vaccine3.length>0){
				for(int i=0;i<arryinao_inactivated_vaccine3.length;i++){
					if(i==0)vare_yinao_inactivated_vaccine3_date.setText(arryinao_inactivated_vaccine3[i]);
					if(i==1)vare_yinao_inactivated_vaccine3_position.setText(arryinao_inactivated_vaccine3[i]);
					if(i==2)vare_yinao_inactivated_vaccine3_batch_num.setText(arryinao_inactivated_vaccine3[i]);
					if(i==3)vare_yinao_inactivated_vaccine3_doctor.setText(arryinao_inactivated_vaccine3[i]);
					if(i==4)vare_yinao_inactivated_vaccine3_remark.setText(arryinao_inactivated_vaccine3[i]);
				}
			}
		}
		if(vr2.getVare_yinao_inactivated_vaccine4()!=null&&vr2.getVare_yinao_inactivated_vaccine4().length()>0){
			String []arryinao_inactivated_vaccine4=vr2.getVare_yinao_inactivated_vaccine4().split(",");
			if(arryinao_inactivated_vaccine4.length>0){
				for(int i=0;i<arryinao_inactivated_vaccine4.length;i++){
					if(i==0)vare_yinao_inactivated_vaccine4_date.setText(arryinao_inactivated_vaccine4[i]);
					if(i==1)vare_yinao_inactivated_vaccine4_position.setText(arryinao_inactivated_vaccine4[i]);
					if(i==2)vare_yinao_inactivated_vaccine4_batch_num.setText(arryinao_inactivated_vaccine4[i]);
					if(i==3)vare_yinao_inactivated_vaccine4_doctor.setText(arryinao_inactivated_vaccine4[i]);
					if(i==4)vare_yinao_inactivated_vaccine4_remark.setText(arryinao_inactivated_vaccine4[i]);
				}
			}
		}
		if(vr2.getVare_yinao_live_vaccine1()!=null&&vr2.getVare_yinao_live_vaccine1().length()>0){
			String []arryinao_live_vaccine1=vr2.getVare_yinao_live_vaccine1().split(",");
			if(arryinao_live_vaccine1.length>0){
				for(int i=0;i<arryinao_live_vaccine1.length;i++){
					if(i==0)vare_yinao_live_vaccine1_date.setText(arryinao_live_vaccine1[i]);
					if(i==1)vare_yinao_live_vaccine1_position.setText(arryinao_live_vaccine1[i]);
					if(i==2)vare_yinao_live_vaccine1_batch_num.setText(arryinao_live_vaccine1[i]);
					if(i==3)vare_yinao_live_vaccine1_doctor.setText(arryinao_live_vaccine1[i]);
					if(i==4)vare_yinao_live_vaccine1_remark.setText(arryinao_live_vaccine1[i]);
				}
			}
		}
		if(vr2.getVare_yinao_live_vaccine2()!=null&&vr2.getVare_yinao_live_vaccine2().length()>0){
			String []arryinao_live_vaccine2=vr2.getVare_yinao_live_vaccine2().split(",");
			if(arryinao_live_vaccine2.length>0){
				for(int i=0;i<arryinao_live_vaccine2.length;i++){
					if(i==0)vare_yinao_live_vaccine2_date.setText(arryinao_live_vaccine2[i]);
					if(i==1)vare_yinao_live_vaccine2_position.setText(arryinao_live_vaccine2[i]);
					if(i==2)vare_yinao_live_vaccine2_batch_num.setText(arryinao_live_vaccine2[i]);
					if(i==3)vare_yinao_live_vaccine2_doctor.setText(arryinao_live_vaccine2[i]);
					if(i==4)vare_yinao_live_vaccine2_remark.setText(arryinao_live_vaccine2[i]);
				}
			}
		}
		if(vr2.getVare_Armour_liver_vaccine_decrease_toxicity()!=null&&vr2.getVare_Armour_liver_vaccine_decrease_toxicity().length()>0){
			String []arrArmour_liver_vaccine_decrease_toxicity=vr2.getVare_Armour_liver_vaccine_decrease_toxicity().split(",");
			if(arrArmour_liver_vaccine_decrease_toxicity.length>0){
				for(int i=0;i<arrArmour_liver_vaccine_decrease_toxicity.length;i++){
					if(i==0)vare_Armour_liver_vaccine_decrease_toxicity_date.setText(arrArmour_liver_vaccine_decrease_toxicity[i]);
					if(i==1)vare_Armour_liver_vaccine_decrease_toxicity_position.setText(arrArmour_liver_vaccine_decrease_toxicity[i]);
					if(i==2)vare_Armour_liver_vaccine_decrease_toxicity_batch_num.setText(arrArmour_liver_vaccine_decrease_toxicity[i]);
					if(i==3)vare_Armour_liver_vaccine_decrease_toxicity_doctor.setText(arrArmour_liver_vaccine_decrease_toxicity[i]);
					if(i==4)vare_Armour_liver_vaccine_decrease_toxicity_remark.setText(arrArmour_liver_vaccine_decrease_toxicity[i]);
				}
			}
		}
		if(vr2.getVare_vaqta1()!=null&&vr2.getVare_vaqta1().length()>0){
			String []arrvaqta1=vr2.getVare_vaqta1().split(",");
			if(arrvaqta1.length>0){
				for(int i=0;i<arrvaqta1.length;i++){
					if(i==0)vare_vaqta1_date.setText(arrvaqta1[i]);
					if(i==1)vare_vaqta1_position.setText(arrvaqta1[i]);
					if(i==2)vare_vaqta1_batch_num.setText(arrvaqta1[i]);
					if(i==3)vare_vaqta1_doctor.setText(arrvaqta1[i]);
					if(i==4)vare_vaqta1_remark.setText(arrvaqta1[i]);
				}
			}
		}
		if(vr2.getVare_vaqta2()!=null&&vr2.getVare_vaqta2().length()>0){
			String []arrvaqta2=vr2.getVare_vaqta2().split(",");
			if(arrvaqta2.length>0){
				for(int i=0;i<arrvaqta2.length;i++){
					if(i==0)vare_vaqta2_date.setText(arrvaqta2[i]);
					if(i==1)vare_vaqta2_position.setText(arrvaqta2[i]);
					if(i==2)vare_vaqta2_batch_num.setText(arrvaqta2[i]);
					if(i==3)vare_vaqta2_doctor.setText(arrvaqta2[i]);
					if(i==4)vare_vaqta2_remark.setText(arrvaqta2[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine1()!=null&&vr2.getVare_other_vaccine1().length()>0){
			String []arrother_vaccine1=vr2.getVare_other_vaccine1().split(",");
			if(arrother_vaccine1.length>0){
				for(int i=0;i<arrother_vaccine1.length;i++){
					if(i==0)vare_other_vaccine1_date.setText(arrother_vaccine1[i]);
					if(i==1)vare_other_vaccine1_position.setText(arrother_vaccine1[i]);
					if(i==2)vare_other_vaccine1_batch_num.setText(arrother_vaccine1[i]);
					if(i==3)vare_other_vaccine1_doctor.setText(arrother_vaccine1[i]);
					if(i==4)vare_other_vaccine1_remark.setText(arrother_vaccine1[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine2()!=null&&vr2.getVare_other_vaccine2().length()>0){
			String []arrother_vaccine2=vr2.getVare_other_vaccine2().split(",");
			if(arrother_vaccine2.length>0){
				for(int i=0;i<arrother_vaccine2.length;i++){
					if(i==0)vare_other_vaccine2_date.setText(arrother_vaccine2[i]);
					if(i==1)vare_other_vaccine2_position.setText(arrother_vaccine2[i]);
					if(i==2)vare_other_vaccine2_batch_num.setText(arrother_vaccine2[i]);
					if(i==3)vare_other_vaccine2_doctor.setText(arrother_vaccine2[i]);
					if(i==4)vare_other_vaccine2_remark.setText(arrother_vaccine2[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine3()!=null&&vr2.getVare_other_vaccine3().length()>0){
			String []arrother_vaccine3=vr2.getVare_other_vaccine3().split(",");
			if(arrother_vaccine3.length>0){
				for(int i=0;i<arrother_vaccine3.length;i++){
					if(i==0)vare_other_vaccine3_date.setText(arrother_vaccine3[i]);
					if(i==1)vare_other_vaccine3_position.setText(arrother_vaccine3[i]);
					if(i==2)vare_other_vaccine3_batch_num.setText(arrother_vaccine3[i]);
					if(i==3)vare_other_vaccine3_doctor.setText(arrother_vaccine3[i]);
					if(i==4)vare_other_vaccine3_remark.setText(arrother_vaccine3[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine4()!=null&&vr2.getVare_other_vaccine4().length()>0){
			String []arrother_vaccine4=vr2.getVare_other_vaccine4().split(",");
			if(arrother_vaccine4.length>0){
				for(int i=0;i<arrother_vaccine4.length;i++){
					if(i==0)vare_other_vaccine4_date.setText(arrother_vaccine4[i]);
					if(i==1)vare_other_vaccine4_position.setText(arrother_vaccine4[i]);
					if(i==2)vare_other_vaccine4_batch_num.setText(arrother_vaccine4[i]);
					if(i==3)vare_other_vaccine4_doctor.setText(arrother_vaccine4[i]);
					if(i==4)vare_other_vaccine4_remark.setText(arrother_vaccine4[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine5()!=null&&vr2.getVare_other_vaccine5().length()>0){
			String []arrother_vaccine5=vr2.getVare_other_vaccine5().split(",");
			if(arrother_vaccine5.length>0){
				for(int i=0;i<arrother_vaccine5.length;i++){
					if(i==0)vare_other_vaccine5_date.setText(arrother_vaccine5[i]);
					if(i==1)vare_other_vaccine5_position.setText(arrother_vaccine5[i]);
					if(i==2)vare_other_vaccine5_batch_num.setText(arrother_vaccine5[i]);
					if(i==3)vare_other_vaccine5_doctor.setText(arrother_vaccine5[i]);
					if(i==4)vare_other_vaccine5_remark.setText(arrother_vaccine5[i]);
				}
			}
		}
		if(vr2.getVare_other_vaccine6()!=null&&vr2.getVare_other_vaccine6().length()>0){
			String []arrother_vaccine6=vr2.getVare_other_vaccine6().split(",");
			if(arrother_vaccine6.length>0){
				for(int i=0;i<arrother_vaccine6.length;i++){
					if(i==0)vare_other_vaccine6_date.setText(arrother_vaccine6[i]);
					if(i==1)vare_other_vaccine6_position.setText(arrother_vaccine6[i]);
					if(i==2)vare_other_vaccine6_batch_num.setText(arrother_vaccine6[i]);
					if(i==3)vare_other_vaccine6_doctor.setText(arrother_vaccine6[i]);
					if(i==4)vare_other_vaccine6_remark.setText(arrother_vaccine6[i]);
				}
			}
		}
	}
	public boolean saveVaccinationRecordView2(){
		VaccinationRecord vr2=new VaccinationRecord(myContext);
		vr2.selectVaccinationRecord(ProfileId);
		vr2.setVare_AMenV1(vare_AMenV1_date.getText().toString()+","+
				vare_AMenV1_position.getText().toString()+","+
				vare_AMenV1_batch_num.getText().toString()+","+
				vare_AMenV1_doctor.getText().toString()+","+
				vare_AMenV1_remark.getText().toString());
		vr2.setVare_AMenV2(vare_AMenV2_date.getText().toString()+","+
				vare_AMenV2_position.getText().toString()+","+
				vare_AMenV2_batch_num.getText().toString()+","+
				vare_AMenV2_doctor.getText().toString()+","+
				vare_AMenV2_remark.getText().toString());
		vr2.setVare_A_CMenV1(vare_A_CMenV1_date.getText().toString()+","+
				vare_A_CMenV1_position.getText().toString()+","+
				vare_A_CMenV1_batch_num.getText().toString()+","+
				vare_A_CMenV1_doctor.getText().toString()+","+
				vare_A_CMenV1_remark.getText().toString());
		vr2.setVare_A_CMenV2(vare_A_CMenV2_date.getText().toString()+","+
				vare_A_CMenV2_position.getText().toString()+","+
				vare_A_CMenV2_batch_num.getText().toString()+","+
				vare_A_CMenV2_doctor.getText().toString()+","+
				vare_A_CMenV2_remark.getText().toString());
		vr2.setVare_yinao_live_vaccine1(vare_yinao_live_vaccine1_date.getText().toString()+","+
				vare_yinao_live_vaccine1_position.getText().toString()+","+
				vare_yinao_live_vaccine1_batch_num.getText().toString()+","+
				vare_yinao_live_vaccine1_doctor.getText().toString()+","+
				vare_yinao_live_vaccine1_remark.getText().toString());
		vr2.setVare_yinao_live_vaccine2(vare_yinao_live_vaccine2_date.getText().toString()+","+
				vare_yinao_live_vaccine2_position.getText().toString()+","+
				vare_yinao_live_vaccine2_batch_num.getText().toString()+","+
				vare_yinao_live_vaccine2_doctor.getText().toString()+","+
				vare_yinao_live_vaccine2_remark.getText().toString());
		vr2.setVare_yinao_inactivated_vaccine1(vare_yinao_inactivated_vaccine1_date.getText().toString()+","+
				vare_yinao_inactivated_vaccine1_position.getText().toString()+","+
				vare_yinao_inactivated_vaccine1_batch_num.getText().toString()+","+
				vare_yinao_inactivated_vaccine1_doctor.getText().toString()+","+
				vare_yinao_inactivated_vaccine1_remark.getText().toString());
		vr2.setVare_yinao_inactivated_vaccine2(vare_yinao_inactivated_vaccine2_date.getText().toString()+","+
				vare_yinao_inactivated_vaccine2_position.getText().toString()+","+
				vare_yinao_inactivated_vaccine2_batch_num.getText().toString()+","+
				vare_yinao_inactivated_vaccine2_doctor.getText().toString()+","+
				vare_yinao_inactivated_vaccine2_remark.getText().toString());
		vr2.setVare_yinao_inactivated_vaccine3(vare_yinao_inactivated_vaccine3_date.getText().toString()+","+
				vare_yinao_inactivated_vaccine3_position.getText().toString()+","+
				vare_yinao_inactivated_vaccine3_batch_num.getText().toString()+","+
				vare_yinao_inactivated_vaccine3_doctor.getText().toString()+","+
				vare_yinao_inactivated_vaccine3_remark.getText().toString());
		vr2.setVare_yinao_inactivated_vaccine4(vare_yinao_inactivated_vaccine4_date.getText().toString()+","+
				vare_yinao_inactivated_vaccine4_position.getText().toString()+","+
				vare_yinao_inactivated_vaccine4_batch_num.getText().toString()+","+
				vare_yinao_inactivated_vaccine4_doctor.getText().toString()+","+
				vare_yinao_inactivated_vaccine4_remark.getText().toString());
		vr2.setVare_Armour_liver_vaccine_decrease_toxicity(vare_Armour_liver_vaccine_decrease_toxicity_date.getText().toString()+","+
				vare_Armour_liver_vaccine_decrease_toxicity_position.getText().toString()+","+
				vare_Armour_liver_vaccine_decrease_toxicity_batch_num.getText().toString()+","+
				vare_Armour_liver_vaccine_decrease_toxicity_doctor.getText().toString()+","+
				vare_Armour_liver_vaccine_decrease_toxicity_remark.getText().toString());
		vr2.setVare_vaqta1(vare_vaqta1_date.getText().toString()+","+
				vare_vaqta1_position.getText().toString()+","+
				vare_vaqta1_batch_num.getText().toString()+","+
				vare_vaqta1_doctor.getText().toString()+","+
				vare_vaqta1_remark.getText().toString());
		vr2.setVare_vaqta2(vare_vaqta2_date.getText().toString()+","+
				vare_vaqta2_position.getText().toString()+","+
				vare_vaqta2_batch_num.getText().toString()+","+
				vare_vaqta2_doctor.getText().toString()+","+
				vare_vaqta2_remark.getText().toString());
		vr2.setVare_other_vaccine1(vare_other_vaccine1_date.getText().toString()+","+
				vare_other_vaccine1_position.getText().toString()+","+
				vare_other_vaccine1_batch_num.getText().toString()+","+
				vare_other_vaccine1_doctor.getText().toString()+","+
				vare_other_vaccine1_remark.getText().toString());
		vr2.setVare_other_vaccine2(vare_other_vaccine2_date.getText().toString()+","+
				vare_other_vaccine2_position.getText().toString()+","+
				vare_other_vaccine2_batch_num.getText().toString()+","+
				vare_other_vaccine2_doctor.getText().toString()+","+
				vare_other_vaccine2_remark.getText().toString());
		vr2.setVare_other_vaccine3(vare_other_vaccine3_date.getText().toString()+","+
				vare_other_vaccine3_position.getText().toString()+","+
				vare_other_vaccine3_batch_num.getText().toString()+","+
				vare_other_vaccine3_doctor.getText().toString()+","+
				vare_other_vaccine3_remark.getText().toString());
		vr2.setVare_other_vaccine4(vare_other_vaccine4_date.getText().toString()+","+
				vare_other_vaccine4_position.getText().toString()+","+
				vare_other_vaccine4_batch_num.getText().toString()+","+
				vare_other_vaccine4_doctor.getText().toString()+","+
				vare_other_vaccine4_remark.getText().toString());
		vr2.setVare_other_vaccine5(vare_other_vaccine5_date.getText().toString()+","+
				vare_other_vaccine5_position.getText().toString()+","+
				vare_other_vaccine5_batch_num.getText().toString()+","+
				vare_other_vaccine5_doctor.getText().toString()+","+
				vare_other_vaccine5_remark.getText().toString());
		vr2.setVare_other_vaccine6(vare_other_vaccine6_date.getText().toString()+","+
				vare_other_vaccine6_position.getText().toString()+","+
				vare_other_vaccine6_batch_num.getText().toString()+","+
				vare_other_vaccine6_doctor.getText().toString()+","+
				vare_other_vaccine6_remark.getText().toString());
		vr2.updateVaccinationRecord(ProfileId);
		return true;
	}
	@Override
	
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		if(v==vare_AMenV1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_AMenV1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_AMenV1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_AMenV2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_AMenV2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_AMenV2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_A_CMenV1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_A_CMenV1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_A_CMenV1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_A_CMenV2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_A_CMenV2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_A_CMenV2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_live_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_live_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_live_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_live_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_live_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_live_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_inactivated_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_inactivated_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_inactivated_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_inactivated_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_inactivated_vaccine3_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_inactivated_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_yinao_inactivated_vaccine4_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_yinao_inactivated_vaccine4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_Armour_liver_vaccine_decrease_toxicity_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_Armour_liver_vaccine_decrease_toxicity_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_vaqta1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_vaqta1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_vaqta1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_vaqta2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_vaqta2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_vaqta2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine3_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine4_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine5_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine5_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine5_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_other_vaccine6_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_other_vaccine6_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine6_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
	}

	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==vare_AMenV1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_AMenV1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_AMenV1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_AMenV2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_AMenV2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_AMenV2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_A_CMenV1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_A_CMenV1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_A_CMenV1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_A_CMenV2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_A_CMenV2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_A_CMenV2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_live_vaccine1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_live_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_live_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_live_vaccine2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_live_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_live_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_inactivated_vaccine1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_inactivated_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_inactivated_vaccine2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_inactivated_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_inactivated_vaccine3_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_inactivated_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_yinao_inactivated_vaccine4_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_yinao_inactivated_vaccine4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_yinao_inactivated_vaccine4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_Armour_liver_vaccine_decrease_toxicity_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_Armour_liver_vaccine_decrease_toxicity_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_Armour_liver_vaccine_decrease_toxicity_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_vaqta1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_vaqta1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_vaqta1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_vaqta2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_vaqta2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_vaqta2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine1_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine2_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine3_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine4_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine5_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine5_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine5_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		if(v==vare_other_vaccine6_date){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.vare_other_vaccine6_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_other_vaccine6_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		
	}

}

